import React, { Component } from 'react';
import './index.css';

export default class Item extends Component {
    update =(id) =>{
        return (e)=>{
            console.log(id,e.target.checked);
            this.props.updateTodo(id,e.target.checked);
        }
    }
    render() {
        const { id, name, done } = this.props;
        return (
            <li>
                <label>
                    <input type="checkbox" checked = {done} onChange={this.update(id)} />
                    <span>{name}</span>
                </label>
                <button className="btn btn-danger" style={{ display: 'none' }}>删除</button>
            </li>
        );
    }
}
